# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgbase=python-backports-lzma
pkgname=('python2-backports-lzma' 'python-backports-lzma')
_pkgname=backports.lzma
pkgver=0.0.14
_pyver=3.13
pkgrel=12
pkgdesc="Backport of Python 3.3's standard library module lzma for LZMA/XY compressed files."
arch=('x86_64' 'aarch64')
url='https://github.com/peterjc/backports.lzma'
license=('BSD')
makedepends=('python2-setuptools' 'python-setuptools')
source=("https://files.pythonhosted.org/packages/source/${_pkgname::1}/$_pkgname/$_pkgname-$pkgver.tar.gz")
sha512sums=('1c64bb7bc3123efd224ff6fb94151f6d785808c6baa21f50233cc878307be4da38e09f0fe9ecf278eebe8bde629fafdd005252a369578796ffa17756cd02b187')

prepare() {
  cp -a "$_pkgname-$pkgver"{,-2}
}

build() {
  cd "$_pkgname-$pkgver-2"

  python2 setup.py build

  cd "$srcdir/$_pkgname-$pkgver"

  python setup.py build
}

package_python2-backports-lzma() {
  depends=('python2')

  cd "$_pkgname-$pkgver-2"

  python2 setup.py install --prefix=/usr --root="$pkgdir" -O1 --skip-build

  rm -rf "$pkgdir/usr/lib/python2.7/site-packages/backports/"{__pycache__,__init__.py}
}

package_python-backports-lzma() {
  depends=('python')

  cd "$_pkgname-$pkgver"

  python setup.py install --root="$pkgdir" --prefix=/usr -O1 --skip-build

  rm -rf "$pkgdir/usr/lib/python$_pyver/site-packages/backports/"{__pycache__,__init__.py}
}

